package C048;

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

/**
 * ClassName: C03
 * Package: C048
 * Description:
 *
 * @Author BCXJ
 * @Create 2025/2/15 13:13
 * @Version 1.0
 * @Since 1.0
 */
public class C03 {
    public static int MAXN = 1002;

    public static int[][] arr = new int[MAXN][MAXN];
    static int n,m;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        while (in.nextToken() != StreamTokenizer.TT_EOF) {
            n = (int) in.nval;
            in.nextToken();
            m = (int) in.nval;
            int r1,c1,r2,c2;
            for (int i = 1, a, b, c, d; i <= m; i++) {
                in.nextToken();
                a = (int) in.nval;
                in.nextToken();
                b = (int) in.nval;
                in.nextToken();
                c = (int) in.nval;
                in.nextToken();
                d = (int) in.nval;
                set(a,b,c,d);
            }
            setSum();
            for (int i = 1; i <= n; i++) {
                out.print(arr[i][1]);
                for (int j = 2; j <= n; j++) {
                    out.print(" " + arr[i][j]);
                }
                out.println();
            }
            clear();
        }
        out.flush();
        out.close();
        br.close();
    }

    private static void clear() {
        for (int i = 0; i < arr.length; i++) {
            Arrays.fill(arr[i],0);
        }
    }

    private static void setSum() {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                arr[i][j] += (arr[i][j - 1] + arr[i - 1][j] - arr[i - 1][j - 1]);
            }
        }
    }

    private static void set(int r1, int c1, int r2, int c2) {
        r2 ++;
        c2 ++;
        arr[r1][c1] += 1;
        arr[r2][c2] += 1;
        arr[r2][c1] -= 1;
        arr[r1][c2] -= 1;
    }
}
